home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / music / cthugha5.zip / CTHU5SRC.ZIP / DISPLAY.C < prev    next >
C/C++ Source or Header  |  1994-08-19  |  1KB  |  85 lines

  1. //
  2. // Cthugha - Audio Seeded Image Processing
  3. //
  4. // Zaph, Digital Aasvogel Group, Torps Productions 1993-1994
  5. //
  6.  
  7.  
  8. #include <stdio.h>
  9. #include <dos.h>
  10. #include <io.h>
  11. #include <fcntl.h>
  12. #include <stdlib.h>
  13. #include <math.h>
  14. #include <conio.h>
  15. #include <bios.h>
  16. #include <memory.h>
  17.  
  18. #include "cthugha.h"
  19. #include "charset.h"
  20. #include "zorilkey.h"
  21.  
  22. void display_up(void)
  23. {
  24.     char *screen;
  25.  
  26.     FP_SEG(screen)=0xa000;
  27.     FP_OFF(screen)=0;
  28.  
  29.     memcpy(screen,buff,64000);
  30. }
  31.  
  32.  
  33. void display_dn(void)
  34. {
  35.     char *screen;
  36.     int i;
  37.  
  38.     FP_SEG(screen)=0xa000;
  39.     FP_OFF(screen)=0;
  40.  
  41.     for (i=199; i>=0; i--) {
  42.         memcpy(screen,buff[i],320);
  43.         screen+=320;
  44.     }
  45. }
  46.  
  47.  
  48. void draw_text(int xpos, int ypos, int size, int colour, char *tbuf)
  49. {
  50.     int    x,y,i,j;
  51.     unsigned char                   mask;
  52.     unsigned char *cdef_ptr;
  53.  
  54.     if (size<=0)
  55.            return;
  56.  
  57.     while (*tbuf) {
  58.            cdef_ptr = charset[*tbuf];
  59.            for (y=ypos; y<=ypos+(size*char_height)-1; y+=size) {
  60.             mask=0x80;
  61.             for (x=xpos; x<xpos+(size*(char_width+1)); x+=size) {
  62.                 if ((*cdef_ptr)&mask) {
  63.                     if (size==1)
  64.                         if (curdisplay)
  65.                             buff[199-y][x]=colour;
  66.                         else
  67.                             buff[y][x]=colour;
  68.                     else
  69.                         for (i=0; i<size; i++)
  70.                             for (j=0; j<size; j++)
  71.                                 if (curdisplay)
  72.                                     buff[199-(y+i)][(x+j)]=colour;
  73.                                 else
  74.                                     buff[y+i][x+j]=colour;
  75.                 }
  76.                 mask>>=1;
  77.                 }
  78.             cdef_ptr++;
  79.         }
  80.            tbuf++;
  81.         xpos+=size*(char_width+1);
  82.       }
  83. }
  84.  
  85.